Imports System.ComponentModel

Public Class UnitCollectionPropertyDescriptor
   Inherits PropertyDescriptor

#Region "Protected fields"

   Protected mUnitConfig As UnitConfiguration

#End Region

#Region "Constructors"

   Public Sub New(ByVal iUnitConfig As UnitConfiguration)
      MyBase.New(iUnitConfig.Unit, Nothing)
      Me.mUnitConfig = iUnitConfig
   End Sub

#End Region

#Region "Public Properties"

   Public Overloads Overrides ReadOnly Property Attributes() As AttributeCollection
      Get
         Return New AttributeCollection(Nothing)
      End Get
   End Property

   Public Overloads Overrides Function CanResetValue(ByVal iComponent As Object) As Boolean
      Return True
   End Function

   Public Overloads Overrides ReadOnly Property ComponentType() As Type
      Get
         Return GetType(UnitConfigurationCollection)
      End Get
   End Property

   Public Overloads Overrides ReadOnly Property DisplayName() As String
      Get
         Return Me.mUnitConfig.Site.Name
      End Get
   End Property

   Public Overloads Overrides ReadOnly Property Description() As String
      Get
         Return Me.mUnitConfig.Site.Name
      End Get
   End Property

   Public Overloads Overrides Function GetValue(ByVal iComponent As Object) As Object
      Return Me.mUnitConfig
   End Function

   Public Overloads Overrides ReadOnly Property IsReadOnly() As Boolean
      Get
         Return False
      End Get
   End Property

   Public Overloads Overrides ReadOnly Property Name() As String
      Get
         Return Me.mUnitConfig.Site.Name
      End Get
   End Property

   Public Overloads Overrides ReadOnly Property PropertyType() As Type
      Get
         Return Me.mUnitConfig.GetType()
      End Get
   End Property

   Public Overloads Overrides Sub ResetValue(ByVal iComponent As Object)

   End Sub

   Public Overloads Overrides Function ShouldSerializeValue(ByVal iComponent As Object) As Boolean
      Return True
   End Function

   Public Overloads Overrides Sub SetValue(ByVal iComponent As Object, ByVal value As Object)

   End Sub

#End Region

End Class